package com.xjm.i1.core.struct.node.load;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.HashMap;
import java.util.Map;

/**
 * 加载数据的设备节点集合
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class I1DeviceCollections extends HashMap<String, I1PageCollections> {

    // 设备编号
    private String deviceId;

    // 页节点<页编号，页集合>
    private final Map<String, I1PageCollections> pagesMap = new HashMap<>();

    public I1PageCollections getOrNewPageCollections(String pageId) {
        boolean hasV = pagesMap.containsKey(pageId);
        if (hasV) {
            return pagesMap.get(pageId);
        } else {
            return new I1PageCollections(pageId, null);
        }
    }

}
